Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add any successfully parsed non-nil JSON body to report, regardless of class #795

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

bethesque
Copy link

Goal

The purpose of this PR is to allow any successfully parsed JSON body to be displayed in the request tab of the event page. Previously, only Hashes were included in the event report, which meant that any errors that occurred during the processing of a request with content type application/json-patch+json (where the top level element is an array) did not have enough information to debug the issue.

Design

N/A

Changeset

Before this change, only JSON that was parsed to a non-empty Hash was added to the $request.body event metadata. After this change, any successfully parsed non-nil object will be added.

Testing

I have not updated the tests, as

  • everything was passing
  • the overall intent of the code has not changed
  • there was no specific test case to assert that arrays should NOT be reported
  • the tests in spec/integrations/rack_spec.rb are at such a high level that it would require an extra 64 lines of test code to test each code path of the add_request_body, and this did not seem like a good tradeoff in terms of test maintainability.

Having said that, if it is requested, I will add a new test - it would probably be a unit test that did a naughty test of the private add_request_body method only.

@clr182 clr182 added feature request Request for a new feature backlog We hope to fix this feature/bug in the future labels Sep 12, 2023
@clr182
Copy link

clr182 commented Sep 12, 2023

Hi @bethesque

Thank you for submitting this PR, we will review this when priorities allow.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backlog We hope to fix this feature/bug in the future feature request Request for a new feature
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants